﻿Imports System.Runtime.InteropServices
Public Module mblFunction
    '/******************************************************************/
    '/*                            Constant                            */
    '/******************************************************************/
    '//=============== Protocol Type ===============//
    Public Const PROTOCOL_TCPIP As Integer = 0                ' TCP/IP
    Public Const PROTOCOL_UDP As Integer = 1                  ' UDP

    '//=============== Device Type ===============//
    Public Const DEVICE_TCPIP As Integer = 0                    'TCP/IP Device  
    Public Const DEVICE_USB As Integer = 1                      'USB Device

    Public Const DEVICENAME_TCPIP As String = "TCP/IP"          'TCP/IP Device
    Public Const DEVICENAME_USB As String = "USB"            'USB Device

    '//================== Use Type ===============//
    Public Const USETYPE_ONLYUSERREGISTRATION As Integer = 0    'UseType Only User Registration
    Public Const USETYPE_ONLYONDUTY As Integer = 1              'Only On Duty
    Public Const USETYPE_ONLYOFFDUTY As Integer = 2             'Only Off Duty
    Public Const USETYPE_BOTHONOFFDUTY As Integer = 3           'Both On Off Duty
    Public Const USETYPE_ALL As Integer = 4                     'All Use Type

    Public Const USETYPENAME_ONLYUSERREGISTRATION As String = "Only Use Registration"   'UseType Only User Registration
    Public Const USETYPENAME_ONLYONDUTY As String = "Only On Duty"                      'Only On Duty
    Public Const USETYPENAME_ONLYOFFDUTY As String = "Only Off Duty"                    'Only Off Duty
    Public Const USETYPENAME_BOTHONOFFDUTY As String = "Both On & Off Duty"                  'Both On Off Duty
    Public Const USETYPENAME_ALL As String = "All"                                      'All Use Type

    '//=============== Backup Number Constant ===============//
    Public Const BACKUP_FP_0 As Integer = 0                   ' Finger 0
    Public Const BACKUP_FP_1 As Integer = 1                   ' Finger 1
    Public Const BACKUP_FP_2 As Integer = 2                   ' Finger 2
    Public Const BACKUP_FP_3 As Integer = 3                   ' Finger 3
    Public Const BACKUP_FP_4 As Integer = 4                   ' Finger 4
    Public Const BACKUP_FP_5 As Integer = 5                   ' Finger 5
    Public Const BACKUP_FP_6 As Integer = 6                   ' Finger 6
    Public Const BACKUP_FP_7 As Integer = 7                   ' Finger 7
    Public Const BACKUP_FP_8 As Integer = 8                   ' Finger 8
    Public Const BACKUP_FP_9 As Integer = 9                   ' Finger 9
    Public Const BACKUP_PSW As Integer = 10                   ' Password
    Public Const BACKUP_CARD As Integer = 11                  ' Card

    '//=============== Error code ===============//
    Public Const RUN_SUCCESS As Integer = 1
    Public Const RUNERR_NOSUPPORT As Integer = 0
    Public Const RUNERR_UNKNOWNERROR As Integer = -1
    Public Const RUNERR_NO_OPEN_COMM As Integer = -2
    Public Const RUNERR_WRITE_FAIL As Integer = -3
    Public Const RUNERR_READ_FAIL As Integer = -4
    Public Const RUNERR_INVALID_PARAM As Integer = -5
    Public Const RUNERR_NON_CARRYOUT As Integer = -6
    Public Const RUNERR_DATAARRAY_END As Integer = -7
    Public Const RUNERR_DATAARRAY_NONE As Integer = -8
    Public Const RUNERR_MEMORY As Integer = -9
    Public Const RUNERR_MIS_PASSWORD As Integer = -10
    Public Const RUNERR_MEMORYOVER As Integer = -11
    Public Const RUNERR_DATADOUBLE As Integer = -12
    Public Const RUNERR_MANAGEROVER As Integer = -14
    Public Const RUNERR_FPDATAVERSION As Integer = -15

    '//=============== VerifyMode of GeneralLogData ===============//
    Public Const LOG_FPVERIFY As Integer = 1                  ' Fp Verify
    Public Const LOG_PASSVERIFY As Integer = 2                ' Pass Verify
    Public Const LOG_CARDVERIFY As Integer = 3                ' Card Verify
    Public Const LOG_FPPASS_VERIFY As Integer = 4             ' Pass+Fp Verify
    Public Const LOG_FPCARD_VERIFY As Integer = 5             ' Card+Fp Verify
    Public Const LOG_PASSFP_VERIFY As Integer = 6             ' Pass+Fp Verify
    Public Const LOG_CARDFP_VERIFY As Integer = 7             ' Card+Fp Verify
    Public Const LOG_OPEN_DOOR As Integer = 10                ' Door Open
    Public Const LOG_CLOSE_DOOR As Integer = 11               ' Door Close
    Public Const LOG_OPEN_HAND As Integer = 12                ' Hand Open
    Public Const LOG_OPEN_THREAT As Integer = 13              ' Door Open threat
    Public Const LOG_PROG_OPEN As Integer = 14                ' PC   Open
    Public Const LOG_PROG_CLOSE As Integer = 15               ' PC   Close
    Public Const LOG_OPEN_IREGAL As Integer = 16              ' Iregal Open
    Public Const LOG_CLOSE_IREGAL As Integer = 17             ' Iregal Close
    Public Const LOG_OPEN_COVER As Integer = 18               ' Cover Open
    Public Const LOG_CLOSE_COVER As Integer = 19              ' Cover Close

    '//=============== IOMode of GeneralLogData ===============//
    Public Const LOG_IOMODE_IN As Integer = 0
    Public Const LOG_IOMODE_OUT As Integer = 1
    Public Const LOG_IOMODE_OVER_IN As Integer = 2    ' = LOG_IOMODE_IO
    Public Const LOG_IOMODE_OVER_OUT As Integer = 3

    '/******************************************************************/
    '/*                            Function                            */
    '/******************************************************************/
    ' ========== FingerKeeper Interface Functions =========='
    'Check Connect
    ' ========== FingerKeeper Interface Functions =========='
    Public Declare Function FK_ConnectComm Lib "FKAttend" (ByVal nMachineNo As Int32, ByVal nComPort As Int32, ByVal nBaudRate As Int32, ByVal pstrTelNumber As String, ByVal nWaitDialTime As Int32, ByVal nLicense As Int32) As Int32
    Public Declare Function FK_ConnectNet Lib "FKAttend" (ByVal nMachineNo As Int32, ByVal strIpAddress As String, ByVal nNetPort As Int32, ByVal nTimeOut As Int32, ByVal nProtocolType As Int32, ByVal nNetPassword As Int32, ByVal nLicense As Int32) As Int32
    Public Declare Function FK_ConnectUSB Lib "FKAttend" (ByVal nMachineNo As Int32, ByVal nLicense As Int32) As Int32
    Public Declare Sub FK_DisConnect Lib "FKAttend" (ByVal nHandleIndex As Int32)
    Public Declare Function FK_EnableDevice Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnableFlag As Byte) As Int32
    Public Declare Sub FK_PowerOnAllDevice Lib "FKAttend" (ByVal nHandleIndex As Int32)
    Public Declare Function FK_PowerOffDevice Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_GetDeviceStatus Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nStatusIndex As Int32, ByRef pnValue As Int32) As Int32
    Public Declare Function FK_GetDeviceTime Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef pnDateTime As Date) As Int32
    Public Declare Function FK_SetDeviceTime Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nDateTime As Date) As Int32
    Public Declare Function FK_GetDeviceInfo Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nInfoIndex As Int32, ByRef pnValue As Int32) As Int32
    Public Declare Function FK_SetDeviceInfo Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nInfoIndex As Int32, ByVal nValue As Int32) As Int32
    Public Declare Function FK_GetProductData Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nDataIndex As Int32, ByVal pstrValue As String) As Int32
    Public Declare Function FK_LoadSuperLogData Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nReadMark As Int32) As Int32
    Public Declare Function FK_USBLoadSuperLogDataFromFile Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal astrFilePath As String) As Int32
    Public Declare Function FK_GetSuperLogData Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef pnSEnrollNumber As Int32, ByRef pnGEnrollNumber As Int32, ByRef nManipulation As Int32, ByRef pnBackupNumber As Int32, ByRef pnDateTime As Date) As Int32
    Public Declare Function FK_EmptySuperLogData Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_LoadGeneralLogData Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nReadMark As Int32) As Int32
    Public Declare Function FK_USBLoadGeneralLogDataFromFile Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal astrFilePath As String) As Int32
    Public Declare Function FK_GetGeneralLogData Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef pnEnrollNumber As Int32, ByRef pnVerifyMode As Int32, ByRef pnInOutMode As Int32, ByRef pnDateTime As Date) As Int32
    Public Declare Function FK_EmptyGeneralLogData Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_GetBellTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef pnBellCount As Int32, ByRef apstrBellInfo As String) As Int32
    Public Declare Function FK_SetBellTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nBellCount As Int32, ByVal apstrBellInfo As String) As Int32
    Public Declare Function FK_GetEnrollDataWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nBackupNumber As Int32, ByRef pnMachinePrivilege As Int32, ByRef pnEnrollData As String) As Int32
    Public Declare Function FK_PutEnrollDataWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nBackupNumber As Int32, ByVal nMachinePrivilege As Int32, ByVal pnEnrollData As String) As Int32
    Public Declare Function FK_SaveEnrollData Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_DeleteEnrollData Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nBackupNumber As Int32) As Int32
    Public Declare Function FK_USBReadAllEnrollDataFromFile Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal pstrFilePath As String) As Int32
    Public Declare Function FK_USBReadAllEnrollDataCount Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal pnValue As Int32) As Int32
    Public Declare Function FK_USBGetOneEnrollDataWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef pnEnrollNumber As Int32, ByRef pnBackupNumber As Int32, ByRef pnMachinePrivilege As Int32, ByRef apstrEnrollData As String, ByRef pnEnableFlag As Int32, ByRef pnEnrollName As String) As Int32
    Public Declare Function FK_USBSetOneEnrollDataWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nBackupNumber As Int32, ByVal nMachinePrivilege As Int32, ByVal apstrEnrollData As String, ByVal nEnableFlag As Int32, ByVal pnEnrollName As String) As Int32
    Public Declare Function FK_USBWriteAllEnrollDataToFile Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal pstrFilePath As String) As Int32
    Public Declare Function FK_EnableUser Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nBackupNumber As Int32, ByVal nEnableFlag As Int32) As Int32
    Public Declare Function FK_ModifyPrivilege Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nBackupNumber As Int32, ByVal nMachinePrivilege As Int32) As Int32
    Public Declare Function FK_ReadAllUserID Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_GetAllUserID Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef pnEnrollNumber As Int32, ByRef pnBackupNumber As Int32, ByRef pnMachinePrivilege As Int32, ByRef pnEnable As Int32) As Int32
    Public Declare Function FK_EmptyEnrollData Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_ClearKeeperData Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_GetUserName Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByRef pstrUserName As String) As Int32
    Public Declare Function FK_SetUserName Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal pstrUserName As String) As Int32
    Public Declare Function FK_GetNewsMessage Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nNewsId As Int32, ByRef pstrNews As String) As Int32
    Public Declare Function FK_SetNewsMessage Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nNewsId As Int32, ByVal pstrNews As String) As Int32
    Public Declare Function FK_GetUserNewsID Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByRef pnNewsId As Int32) As Int32
    Public Declare Function FK_SetUserNewsID Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal nEnrollNumber As Int32, ByVal nNewsId As Int32) As Int32
    Public Declare Function FK_GetDoorStatus Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef apnStatusVal As Int32) As Int32
    Public Declare Function FK_SetDoorStatus Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anStatusVal As Int32) As Int32

    Public Declare Function FK_GetPassTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anPassTimeID As Int32, ByRef apstrPassTime As String) As Int32
    Public Declare Function FK_SetPassTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anPassTimeID As Int32, ByVal apstrPassTime As String) As Int32
    Public Declare Function FK_GetPassTime Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anPassTimeID As Int32, ByRef apnPassTime As Int32, ByVal anPassTimeSize As Int32) As Int32
    Public Declare Function FK_SetPassTime Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anPassTimeID As Int32, ByRef apnPassTime As Int32, ByVal anPassTimeSize As Int32) As Int32
    Public Declare Function FK_GetUserPassTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anEnrollNumber As Int32, ByRef apnGroupID As Int32, ByRef apstrPassTimeID As String) As Int32
    Public Declare Function FK_SetUserPassTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anEnrollNumber As Int32, ByVal anGroupID As Int32, ByVal apstrPassTimeID As String) As Int32
    Public Declare Function FK_GetGroupPassTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anGroupID As Int32, ByRef apstrPassTimeID As String) As Int32
    Public Declare Function FK_SetGroupPassTimeWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal anGroupID As Int32, ByVal apstrPassTimeID As String) As Int32
    Public Declare Function FK_GetGroupMatchWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByRef apstrGroupMatch As String) As Int32
    Public Declare Function FK_SetGroupMatchWithString Lib "FKAttend" (ByVal nHandleIndex As Int32, ByVal apstrGroupMatch As String) As Int32
    Public Declare Function FK_BenumbAllManager Lib "FKAttend" (ByVal nHandleIndex As Int32) As Int32
    Public Declare Function FK_ConnectGetIP Lib "FKAttend" (ByRef apnComName As String) As Long

End Module
